extends layout

block content

    //- if else
    - var author = 'Andy'
        if author
            p 作者：#{author}
        else
            p 无作者

    //- case-when
    - var authors = ['Andy', 'Lucifer']
        case authors[0]
            when 'Andy'
                p 作者是Andy
            when 'Lucifer'
                p 作者是Lucifer

    //- for-in
    - var person = {name:'Andy', gender:'Male'}
    - for (var prop in person)
        p= person[prop]

    //- each-in
    - var employee = {name:'andy', gender:'male'}
    - each value, key in employee
        p #{key}: #{value}

    - var language = ['java', 'php', 'c']
        ul
            - each item in language
                li #{item}

    //- while
    - var n = 0
        ul
            while n < 5
                li= n++

    //- mixin
    // 无参数函数
    mixin sayHi
        p Hi
    +sayHi


    //- 有参数函数
    mixin personInfo(name, hobbies)
        +sayHi
        p #{name}'s hobbies
            ul.hobby
                each hobby in hobbies
                    li= hobby
    +personInfo('andy', ['read', 'play'])